var boardWrite = new Ext.form.FormPanel( {
	xtype: 'form',
	id : 'boardForm',
	method : 'POST',
	standardSubmit : true,
	scroll: 'vertical',
	items : [ {
		xtype : 'fieldset',
		title : '게시판 작성',
		//instructions : 'instructions은 아래에 나타나는 내용~',
		defaults : {
			// labelAlign: 'right'
			labelWidth : '15%',
			style : {
				border : "1px solid #ff0000"
			}
		},
		items : [ {
			xtype : 'textfield',
			name : 'name',
			label : 'name',
			placeHolder : '제목 입력 하세요',
			autoCapitalize : true,
			required : true,
			useClearIcon : true
		}, {
			xtype : 'textfield',
			name : 'writer',
			label : 'writer',
			placeHolder : '개똥이',
			autoCapitalize : true,
			required : true,
			useClearIcon : true
		}, {
			xtype : 'textareafield',
			name : 'content',
			label : 'content',
			useClearIcon : true,
			enterIsSpecial : true
		}, {
			xtype:'button',
			width: '15%',
			text: '등록',
			iconCls:'round',
			iconAlign: 'top',
			handler:function(){
				doBoardWriteSubmit();
			},
		} ]
	} ]
})

var doBoardWriteSubmit = function()
{
	panel.setLoading(true, false);
	Ext.Ajax.request({
    	url: '../insertBoard.do',
        method: 'post',
        params: {subject: boardWrite.getValues().name, 
        	writer : boardWrite.getValues().writer,
        	content : boardWrite.getValues().content.replace(/\n/g, "<br/>")  },
        success: function(response, opts) {
        	//data = Ext.decode(response.responseText);
            panel.setLoading(false);
            Ext.Msg.alert('Write Success');
            boardStore.load();
            boardWrite.reset();
        }
    });
}